<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid" %>
<%@ page import="com.rcm.model.*" %>
<rapid:override name="head">
	<title>选课结果</title>
</rapid:override>
<rapid:override name="content">
	<%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>

	<div style="height:500px;">
		<table class="layui-table" style="margin-top:15px;">

			<form action="${pageContext.request.contextPath}/Teacherinfocontroller/querycourses" method="post">
				<input type="text" class="layui-input" name="sid" value="${s.sid}" placeholder="学生学号" style="width:159px;margin-right: 10px;margin-top: 10px;">
				<input type="text" class="layui-input" name="name" value="${s.name}" placeholder="学生姓名" style="width:159px;margin-right: 10px;">
				<input type="text" class="layui-input" name="choice_a" value="${s.choice_a}" placeholder="选课1" style="width:159px;margin-right: 10px;">
				<input type="text" class="layui-input" name="choice_b" value="${s.choice_b}" placeholder="选课2" style="width:159px;margin-right: 10px;">
				<input type="text" class="layui-input" name="choice_c" value="${s.choice_c}" placeholder="选课3" style="width:159px;margin-right: 10px;">
				<input type="text" class="layui-input" name="choice_d" value="${s.choice_d}" placeholder="选课4" style="width:159px;margin-right: 10px;">
				<input type="text" class="layui-input" name="choice_e" value="${s.choice_e}" placeholder="选课5" style="width:159px;margin-right: 10px;">
				<input type="text" class="layui-input" name="choice_f" value="${s.choice_f}" placeholder="选课6" style="width:161px;margin-right: 10px;">

				<input class="layui-btn layui-btn-danger layui-btn-lg" type="submit" value="搜索">
			</form>
			<thead>
				<tr>
					<th>学生学号</th>
					<th>学生姓名</th>
					<th>选课1</th>
					<th>选课2</th>
					<th>选课3</th>
					<th>选课4</th>
					<th>选课5</th>
					<th>选课6</th>
					<th>选课时间</th>
					<th>选课IP</th>

				</tr>
			</thead>
			<tbody>
				<c:forEach items="${pageInfo.list}" var="c">
					<tr>
						<td>${c.sid}</td>
						<td>${c.name}</td>
						<td>${c.choice_a}</td>
						<td>${c.choice_b}</td>
						<td>${c.choice_c}</td>
						<td>${c.choice_d}</td>
						<td>${c.choice_e}</td>
						<td>${c.choice_f}</td>
						<td>${c.cdate}</td>
						<td>${c.cip}</td>

					</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>
	<div style="text-align:center; margin-top:10px; margin-left:-100px;">
		<c:if test="${pageInfo.total>=0}">
			<p style=" color: black; font-size:16px; margin-bottom:10px;">当前第 ${pageInfo.pageNum}
				页/共 ${pageInfo.pages} 页</p>
			<c:choose>
				<c:when test="${pageInfo.pageNum==1 }">
					<button class="layui-btn layui-btn-disabled">首页</button>
					<button class="layui-btn layui-btn-disabled">上一页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pageNum+1})">下一页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pages})">末页</button>
				</c:when>
				<c:when test="${pageInfo.pageNum>=1 && pageInfo.pageNum<pageInfo.pages}">
					<button class="layui-btn " onclick="goPage(1)">首页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pageNum-1})">上一页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pageNum+1})">下一页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pages})">末页</button>
				</c:when>
				<c:when test="${pageInfo.pages==1}">
					<button class="layui-btn layui-btn-disabled">首页</button>
					<button class="layui-btn layui-btn-disabled" ">上一页</button>
                    <button class=" layui-btn
					 layui-btn-disabled">下一页</button>
					<button class="layui-btn layui-btn-disabled">末页</button>
				</c:when>
				<c:when test="${pageInfo.pageNum==pageInfo.pages && pageInfo.pages>=1}">
					<button class="layui-btn " onclick="goPage(1)">首页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pageNum-1})">上一页</button>
					<button class="layui-btn layui-btn-disabled">下一页</button>
					<button class="layui-btn layui-btn-disabled">末页</button>
				</c:when>

			</c:choose>
		</c:if>

	</div>

</rapid:override>
<script type="text/javascript">
	function goPage(num) {

		location.href = "http://localhost:8080/ElectiveSystem/Teacherinfocontroller/querycourses?pageNum=" + num;
	}
</script>
<%@ include file="baseteacher.jsp" %>
